using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblCuaHangUI
{ 
	private int idCuaHang;
	public int IdCuaHang
	{
		get { return idCuaHang;}
		set { idCuaHang = value;}
	}

	private String tenCuaHang;
	public String TenCuaHang
	{
		get { return tenCuaHang;}
		set { tenCuaHang = value;}
	}

	private String diaChi;
	public String DiaChi
	{
		get { return diaChi;}
		set { diaChi = value;}
	}

	private String dienThoai;
	public String DienThoai
	{
		get { return dienThoai;}
		set { dienThoai = value;}
	}

	private String fax;
	public String Fax
	{
		get { return fax;}
		set { fax = value;}
	}

	private String email;
	public String Email
	{
		get { return email;}
		set { email = value;}
	}

	private String website;
	public String Website
	{
		get { return website;}
		set { website = value;}
	}

	private String linhVuc;
	public String LinhVuc
	{
		get { return linhVuc;}
		set { linhVuc = value;}
	}

	private String ghiChu;
	public String GhiChu
	{
		get { return ghiChu;}
		set { ghiChu = value;}
	}

	private DateTime ngayTao;
	public DateTime NgayTao
	{
		get { return ngayTao;}
		set { ngayTao = value;}
	}

	public tblCuaHangUI() {}

	public tblCuaHangUI(int idCuaHang, String tenCuaHang, String diaChi, String dienThoai, String fax, String email, String website, String linhVuc, String ghiChu, DateTime ngayTao)
	 {
		this.idCuaHang = idCuaHang;
 		this.tenCuaHang = tenCuaHang;
 		this.diaChi = diaChi;
 		this.dienThoai = dienThoai;
 		this.fax = fax;
 		this.email = email;
 		this.website = website;
 		this.linhVuc = linhVuc;
 		this.ghiChu = ghiChu;
 		this.ngayTao = ngayTao;
 	}

	public int Add(String tenCuaHang, String diaChi, String dienThoai, String fax, String email, String website, String linhVuc, String ghiChu, DateTime ngayTao)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblCuaHang_Add",tenCuaHang,diaChi,dienThoai,fax,email,website,linhVuc,ghiChu,ngayTao);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idCuaHang, String tenCuaHang, String diaChi, String dienThoai, String fax, String email, String website, String linhVuc, String ghiChu, DateTime ngayTao)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblCuaHang_Update",idCuaHang,tenCuaHang,diaChi,dienThoai,fax,email,website,linhVuc,ghiChu,ngayTao);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idCuaHang)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblCuaHang_Delete",idCuaHang);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblCuaHang_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idCuaHang)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblCuaHang_Get",idCuaHang);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblCuaHang_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
